using System.Collections;
using System.ComponentModel;
using System.Windows.Forms.Design;

namespace ICSharpCode.TextEditor.Design
{
    internal class ScrollBarControlDesigner : ControlDesigner
    {
        public override SelectionRules SelectionRules
        {
            get
            {
                PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(base.Component)["Orientation"];
                if (propertyDescriptor != null)
                {
                    ScrollBarOrientation scrollBarOrientation = (ScrollBarOrientation)propertyDescriptor.GetValue(base.Component);
                    if (scrollBarOrientation == ScrollBarOrientation.Vertical)
                    {
                        return SelectionRules.Moveable | SelectionRules.Visible | SelectionRules.TopSizeable | SelectionRules.BottomSizeable;
                    }
                    return SelectionRules.Moveable | SelectionRules.Visible | SelectionRules.LeftSizeable | SelectionRules.RightSizeable;
                }
                return base.SelectionRules;
            }
        }

        protected override void PreFilterProperties(IDictionary properties)
        {
            properties.Remove("Text");
            properties.Remove("BackgroundImage");
            properties.Remove("ForeColor");
            properties.Remove("ImeMode");
            properties.Remove("Padding");
            properties.Remove("BackgroundImageLayout");
            properties.Remove("BackColor");
            properties.Remove("Font");
            properties.Remove("RightToLeft");
            base.PreFilterProperties(properties);
        }
    }
}
